//
//  NetworkServer.h
//  KingSelected
//
//  Created by 杨鹏 on 2023/10/27.
//

#import <Foundation/Foundation.h>
#import <AFNetworking/AFNetworking.h>

NS_ASSUME_NONNULL_BEGIN

typedef void(^RequestSuccessBlock)(NSURLSessionDataTask *_Nonnull task, id  _Nullable responseObject);
typedef void(^RequestFailureBlock)(NSURLSessionDataTask *_Nullable task, NSError *_Nonnull error);
typedef void(^ProgressBlock)(NSProgress * _Nonnull progress);

@interface NetworkServer : NSObject

/// 单例AFHTTPSessionManager对象
+ (AFHTTPSessionManager *_Nonnull)shareManager;

/// POST请求
+ (NSURLSessionDataTask *_Nullable)postWithUrl:(NSString *_Nonnull)urlString httpHeader:(NSDictionary * _Nullable)httpHeader httpBody:(NSDictionary *_Nullable)httpBody progress:(ProgressBlock _Nullable)progress success:(RequestSuccessBlock _Nullable)success failure:(RequestFailureBlock _Nullable)failure;

/// GET请求
+ (NSURLSessionDataTask *_Nullable)getWithUrl:(NSString *_Nonnull)urlString httpHeader:(NSDictionary * _Nullable)httpHeader httpBody:(NSDictionary *_Nullable)httpBody progress:(ProgressBlock _Nullable)progress success:(RequestSuccessBlock _Nullable)success failure:(RequestFailureBlock _Nullable)failure;

/// 上传文件
+ (NSURLSessionDataTask *_Nullable)uploadWithURL:(NSString *_Nonnull)urlString httpHeader:(NSDictionary * _Nullable)httpHeader httpBody:(NSDictionary *_Nullable)httpBody fileData:(NSArray *_Nonnull)fileDataArr fileNames:(NSArray *_Nullable)fileNames mimeType:(NSString *_Nullable)mimeType progress:(ProgressBlock _Nullable)progress success:(RequestSuccessBlock _Nullable)success failure:(RequestFailureBlock _Nullable)failure;

@end

NS_ASSUME_NONNULL_END
